import java.util.ArrayDeque;
import java.util.Queue;
import java.util.Stack;

class RecentCounter {
    Queue<Integer> queue;
    public RecentCounter() {
        queue=new ArrayDeque<>();
    }

    public int ping(int t) {
        queue.offer(t);
        while(queue.peek()<t-3000) {
            queue.poll();
        }
        return queue.size();
    }
}

public class lc933 {
}
